package org.example.shixiguanli.controller;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import org.example.core.enums.ApiResult;
import org.example.shixiguanli.service.TStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Description:
 * Date: 2024/2/15 23:21
 */
@RestController
@RequestMapping("/statistics")
public class TStatisticsController {

    @Autowired
    private TStatisticsService tStatisticsService;

    /**
     * 实习的数量
     * @return
     */
    @GetMapping("/practiceCount")
    public ApiResult practiceCount(){
        JSONObject result = tStatisticsService.practiceCount();
        return ApiResult.success(result);
    }

    /**
     * 每个学生的周志和实习报告数量
     * @return
     */
    @GetMapping("/everyStudentCount")
    public ApiResult everyStudentCount(){
        JSONArray result = tStatisticsService.everyStudentCount();
        return ApiResult.success(result);
    }

    /**
     * 每个岗位学生的数量
     * @return
     */
    @GetMapping("/everyPostCount")
    public ApiResult everyPostCount(){
        Map<String, JSONObject> result = tStatisticsService.everyPostCount();
        return ApiResult.success(result);
    }

}
